package com.example.chenhaosblog.service.impl;

import com.example.chenhaosblog.mapper.DaoSupport;
import com.example.chenhaosblog.service.staffService;
import com.example.chenhaosblog.utils.PageData;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class staffServiceImpl implements staffService {


    @Resource(name = "daoSupport")
    private DaoSupport dao;


    @Override
    public List<PageData> findAll(PageData pageData) throws Exception {
       return (List<PageData>) dao.findForList("staffMapper.findAll", pageData);

    }

    @Override
    public List<PageData> findAll2(PageData pageData) throws Exception {

        return (List<PageData>) dao.findForList("staffMapper.findherbs",pageData);
    }


    @Override
    public void add(PageData pageData) throws Exception {
        dao.save("staffMapper.insert",pageData);

    }

    @Override
    public void update(PageData pageData) throws Exception {
    dao.update("staffMapper.update",pageData);

    }

    @Override
    public PageData findView(PageData pageData) throws Exception {
        return (PageData)dao.findForObject("staffMapper.findDemoInfo", pageData);
    }

    @Override
    public void del(PageData pageData) throws Exception {
        dao.delete("staffMapper.update",pageData);
    }

    @Override
    public void dels(List<String> ids) throws Exception {
        dao.delete("staffMapper.dels",ids);


    }


}
